package com.hqyj.controller;

import com.hqyj.pojo.Customer;
import com.hqyj.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

@Controller
@RequestMapping("/home")
public class adminController {
    @Autowired
    CustomerService customerService;
    //返回首页
    @RequestMapping("/admin")
    public String admin(HttpServletRequest request){
        HttpSession session =request.getSession();
        session.removeAttribute("managerinfo");
        return "admin";
    }
    //访问login.html的方法
    @RequestMapping("/login")
    public String loginPage(){
        return "login";
    }
    // 访问用户首页
    @RequestMapping("/customer")
    public String customer(HttpServletRequest request, ModelMap map){
        HttpSession session = request.getSession();
        Customer customerInfo = (Customer) session.getAttribute("customerInfo");
        customerService.selectnew(customerInfo,request);
        Customer newcustomerInfo = (Customer) session.getAttribute("customerInfo");
        map.addAttribute("customer1",newcustomerInfo);
        return "customer";
    }
    // 访问申请服务页面
    @RequestMapping("/applyService")
    public String applyService(){return "applyService";}

    // 访问申请服务页面
    @RequestMapping("/applyService_High")
    public String applyService1(){return "applyService_High";}
}
